%% Transformix transform_params;

function params = generate_tranformix_parameters_toolbox(patient, scan_folder);

    scan = patient.ref;
registration_folder = [patient.folder_elastix sprintf('/out_phase%d_phase%d', patient.ref, scan)];
temp = import_transformparams([registration_folder '/TransformParameters.0.txt']);

%  transform_params = temp(1);
 transform_params{1,:} = '(Transform "DeformationFieldTransform")';
transform_params{2,:} = '(NumberOfParameters 0)';

dvf_filename = [scan_folder sprintf('/deformationField.mhd')];
transform_params{3,:} = sprintf('(DeformationFieldFileName "%s")',dvf_filename);
transform_params{4,:} = '(DeformationFieldInterpolationOrder 1)';

for p = 5:30;
    transform_params{p,:} = temp{p+1,:};
end

% transform_params{28,:} = '(ResampleInterpolator "FinalBSplineInterpolator")';
% transform_params{29,:} = '(FinalBSplineInterpolationOrder 0)';

file_name = [scan_folder '/Model_TransformParameters.0.txt']
csvwrite_dt(file_name,transform_params)
end